var chengduArr = [
    {School:"成都大学", class:7 , xueshen:70},
    {School:"理工大学", class:5 , xueshen:26},
    {School:"师范大学", class:3 , xueshen:15},
    {School:"思想大学", class:7 , xueshen:89},
];
var mianyangArr = [
    {School:"绵阳大学", class:7 , xueshen:70},
    {School:"绵阳理工大学", class:5 , xueshen:26},
    {School:"绵阳师范大学", class:3 , xueshen:15},
    {School:"绵阳思想大学", class:7 , xueshen:89},
];

var deyangArr = [
    {School:"德阳大学", class:7 , xueshen:70},
    {School:"德阳理工大学", class:5 , xueshen:26},
    {School:"德阳师范大学", class:3 , xueshen:15},
    {School:"德阳思想大学", class:7 , xueshen:89},
];
var leshanArr = [
    {School:"乐山大学", class:7 , xueshen:70},
    {School:"乐山农业大学", class:5 , xueshen:26},
    {School:"乐山师范大学", class:3 , xueshen:15},
    {School:"乐山思想大学", class:7 , xueshen:89},
];


distb();
// 判断城市运行显示数据
$("select").change(function(){
  var  b = $(this).val();
    console.log(b);
    if(b == "成都市"){
        distb();
    }else if (b =="绵阳市" ){
        $("#tbdisplay").html("");
        for(var i = 0 ;i< mianyangArr.length; i++){
            $("#tbdisplay").append(
             `<tr>                    
                <td>${mianyangArr[i].School}</td>
                <td>${mianyangArr[i].class}</td>     
                <td>${mianyangArr[i].xueshen}</td>
            </tr>
                `
            )

        } 
    }else if (b =="德阳市" ){
        $("#tbdisplay").html("");
        for(var i = 0 ;i<deyangArr.length; i++){
            $("#tbdisplay").append(
             `<tr>                    
                <td>${deyangArr[i].School}</td>
                <td>${deyangArr[i].class}</td>     
                <td>${deyangArr[i].xueshen}</td>
            </tr>
                `
            )

        } 
    }else if (b =="乐山市" ){
        $("#tbdisplay").html("");
        for(var i = 0 ;i<leshanArr.length; i++){
            $("#tbdisplay").append(
             `<tr>                    
                <td>${leshanArr[i].School}</td>
                <td>${leshanArr[i].class}</td>     
                <td>${leshanArr[i].xueshen}</td>
            </tr>
                `
            )

        } 
    }
})

// 显示数据 默认成都市
function distb(){
        $("#tbdisplay").html("");
        for(var i = 0 ;i< chengduArr.length; i++){
            $("#tbdisplay").append(
             `<tr>                    
                <td>${chengduArr[i].School}</td>
                <td>${chengduArr[i].class}</td>     
                <td>${chengduArr[i].xueshen}</td>
            </tr>
                `
            )

        }
    }


